package com.sunnada.edu.business.attendance.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.sunnada.edu.system.pub.dao.BaseDaoImpl;

@Repository
public class AttendanceDaoImpl extends BaseDaoImpl implements AttendanceDao {

	@Override
	public int getAttendanceCots(HashMap<String, String> params) {
		List list = selectList("attendance_sqlmap.getAttendanceCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findAttendance(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.findAttendance", params);
	}

	@Override
	public int attendanceDelete(HashMap<String, String> params) {
		return delete("attendance_sqlmap.attendanceDelete", params);
	}

	@Override
	public int attendanceAdd(HashMap<String, String> params) {
		return insert("attendance_sqlmap.attendanceAdd", params);
	}

	@Override
	public int attendanceUpdate(HashMap<String, String> params) {
		return update("attendance_sqlmap.attendanceUpdate", params);
	}

	@Override
	public Map attendanceByRecId(HashMap<String, String> params) {
		List list = selectList("attendance_sqlmap.attendanceByRecId", params);
		if (list != null && list.size() > 0) {
			return (Map) list.get(0);
		}
		return null;
	}

	@Override
	public int getWorkerCots(HashMap<String, String> params) {
		List list = selectList("attendance_sqlmap.getWorkerCots", params);
		if (list != null && list.size() > 0) {
			String cot = ((Map) list.get(0)).get("COT") + "";
			return Integer.valueOf(cot);
		}
		return 0;
	}

	@Override
	public List<?> findWorkers(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.findWorkers", params);
	}

	@Override
	public int attenworkerAdd(HashMap<String, String> params) {
		return insert("attendance_sqlmap.attenworkerAdd", params);
	}
	
	@Override
	public List<?> findAttenworker(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.findAttenworker", params);
	}
	
	@Override
	public List<?> attenworkerById(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.attenworkerById", params);
	}
	
	@Override
	public int attenworkerDelete(HashMap<String, String> params) {
		return delete("attendance_sqlmap.attenworkerDelete", params);
	}
	
	
	@Override
	public List<?> getWorkers(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.getWorkers", params);
	}
	
	@Override
	public List<?> getWorkerGroup(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.getWorkerGroup", params);
	}
	
	@Override
	public List<?> getprojects(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.getprojects", params);
	}
	
	@Override
	public List<?> abnormalAttendance(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.abnormalAttendance", params);
	}
	
	@Override
	public List<?> attendanceData(HashMap<String, String> params) {
		return selectList("attendance_sqlmap.attendanceData", params);
	}
}
